package com.zhixianggou.caibaobox.lottery.dataCollect.cover;

import com.alibaba.fastjson2.JSON;
import com.zhixianggou.caibaobox.lottery.dataCollect.dto.SLotteryDto;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SArray3;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SArray5;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SDaLeTou;
import com.zhixianggou.caibaobox.lottery.dataCollect.entities.SSevenStar;
import com.zhixianggou.caibaobox.lottery.dataShow.vo.SLotteryDataVo;
import com.zhixianggou.caibaobox.lottery.dataShow.vo.SPrizeLevelVo;
import io.swagger.v3.core.util.Json;
import org.apache.catalina.Manager;
import org.apache.commons.lang3.StringUtils;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author zyq
 * 8/22/24 6:06 PM
 */
@Mapper(uses = {AttributeConvertUtil.class})
public interface SLotteryCover {

    SLotteryCover INSTANCE = Mappers.getMapper(SLotteryCover.class);

    @Mapping(source = "dto.lotteryDrawTime", target = "lotteryDrawTime", dateFormat = "yyyy-MM-dd")
    SDaLeTou toDaLeTouPo(SLotteryDto dto);
    List<SDaLeTou> toDaLeTouPo(List<SLotteryDto> dtoList);

    @Mapping(source = "dto.lotteryDrawTime", target = "lotteryDrawTime", dateFormat = "yyyy-MM-dd")
    SArray3 toArray3Po(SLotteryDto dto);
    List<SArray3> toArray3Po(List<SLotteryDto> dtoList);

    @Mapping(source = "dto.lotteryDrawTime", target = "lotteryDrawTime", dateFormat = "yyyy-MM-dd")
    SArray5 toArray5Po(SLotteryDto dto);
    List<SArray5> toArray5Po(List<SLotteryDto> dtoList);

    @Mapping(source = "dto.lotteryDrawTime", target = "lotteryDrawTime", dateFormat = "yyyy-MM-dd")
    SSevenStar toSevenStarPo(SLotteryDto dto);
    List<SSevenStar> toSevenStarPo(List<SLotteryDto> dtoList);

    @Mappings({
            @Mapping(target = "prizeLevelList", source = "prizeLevelList",qualifiedByName = "strToList4SL"),
            @Mapping(target = "lotteryDrawTime", source = "lotteryDrawTime", dateFormat = "yyyy-MM-dd"),
    })
    SLotteryDataVo daLeTou2Vo(SDaLeTou po);
    List<SLotteryDataVo> daLeTou2Vo(List<SDaLeTou> poList);
    @Mapping(target = "prizeLevelList", source = "prizeLevelList",qualifiedByName = "strToList4SL")
    SLotteryDataVo array32Vo(SArray3 po);
    List<SLotteryDataVo> array32Vo(List<SArray3> poList);
    @Mapping(target = "prizeLevelList", source = "prizeLevelList",qualifiedByName = "strToList4SL")
    SLotteryDataVo array52Vo(SArray5 po);
    List<SLotteryDataVo> array52Vo(List<SArray5> poList);
    @Mapping(target = "prizeLevelList", source = "prizeLevelList",qualifiedByName = "strToList4SL")
    SLotteryDataVo sevenStar2Vo(SSevenStar po);
    List<SLotteryDataVo> sevenStar2Vo(List<SSevenStar> poList);

}
